package com.cloud.api.excel;

import com.cloud.api.utils.ExcelUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDate;

/**
 * @author 杨斌
 * 2024-08-16/8/2024
 */
@Getter
@Setter
@Accessors(chain = true)
@ExcelUtils.ExcelSheet(watermark = @ExcelUtils.Watermark(type = 0)
)
@Schema(name = "VehicleProductionExcel", description = "导入表校验类")
public class VehicleProductionExcel implements Serializable {

    @Schema(description = "用于导出错误数据")
    @ExcelUtils.ExcelExport(name = "table.field.errResult",columnWidth = 20)
    private String errResult;

    @Schema(description = "用于接收导入车型")
    @ExcelUtils.ExcelExport(name = "table.field.num",columnWidth = 20)
    private String num;

    @NotEmpty(message = "{validation.Information.vin}")
    @ExcelUtils.ExcelExport(name = "table.field.vin",columnWidth = 20)
    @Size(max = 17,min = 17,message = "{validation.Information.vinSizeExcel}")
    @Pattern(regexp = "^(?=.*[A-Za-z])(?=.*\\d)[A-Za-z\\d]{17}$", message = "{validation.Information.vinPattern}")
    private String vin;

    @Schema(description = "车型")
    @NotEmpty(message = "{validation.Information.modelExcel}")
    @ExcelUtils.ExcelExport(name = "table.field.*vehicleModel",columnWidth = 25)
    private String vehicleModel;


    @Schema(description = "TBOX设备号")
//    @NotEmpty(message = "{validation.Information.tbox}")
//    @Size(max = 17,min = 17,message = "{validation.Information.tboxSizeExcel}")
    @ExcelUtils.ExcelExport(name = "table.field.tbox",columnWidth = 20)
    private String tbox;

    @Schema(description = "SIM卡号")
//    @NotEmpty(message = "{validation.Information.sim}")
//    @Size(max = 20,min = 8,message = "{validation.common.simSizeExcel}")
    @ExcelUtils.ExcelExport(name = "table.field.sim",columnWidth = 20)
    private String sim;


    @Schema(description = "生产日期")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
//    @NotNull(message = "{validation.production.productionDate}")
    @ExcelUtils.ExcelExport(name = "table.field.productionDate",columnWidth = 30)
    private LocalDate productionDate;
}
